package com.oa.oaspcpersonalcenter.mapper;




import com.oa.oaspccommon.po.User;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author Sdx
 * 2021-04-15
 */
//@Mapper
public interface UserMapper {
    //    登录
    @Select("select * from user where username=#{username}")
    public User findUserByUsername(String username);

    //    修改密码
    @Update("update user set password=#{password} where username=#{username}")
    public User changePassword(String username);

    //    查询所有
    @Select("select * from user")
    public List<User> findUsers();

    //    查询单个
    @Select("select * from user where uid=#{uid}")
    public User findUserByUid(int uid);

    //    增加

    @Insert("insert into user(uid,username,password,name,sex,deptname,post,jurisdictiongroup,phone,status,isonline,ismobile,lastload,position,jobtype,entrydata,providefountaccount,companymail,birthday,nation,publicoutlook,address,qqnum,wechat,censusregister,dynamic) values(#{uid},#{username},#{password},#{name},#{sex},#{deptname},#{post},#{jurisdictiongroup},#{phone},#{status},#{isonline},#{ismobile},#{lastload},#{position},#{jobtype},#{entrydata},#{providefountaccount},#{companymail},#{birthday},#{nation},#{publicoutlook},#{address},#{qqnum},#{wechat},#{censusregister},#{dynamic})")
    public boolean addUser(User user);

    //    修改
    @Update("update user set username=#{username},password=#{password},name=#{name},sex=#{sex},deptname=#{deptname},post=#{post},jurisdictiongroup=#{jurisdictiongroup},phone=#{phone},status=#{status},isonline=#{isonline},ismobile=#{ismobile},lastload=#{lastload},position=#{position},jobtype=#{jobtype},entrydata=#{entrydata},providefountaccount=#{providefountaccount},companymail=#{companymail},birthday=#{birthday},nation=#{nation},publicoutlook=#{publicoutlook},address=#{address},qqnum=#{qqnum},wechat=#{wechat},censusregister=#{censusregister},dynamic=#{dynamic} where uid=#{uid}")
    public boolean updateUser(User user);

    //    删除
    @Delete("delete from user where uid=#{uid}")
    public boolean deleteUserByUid(int uid);




}
